<template>
	<div class="realTime-view" :style="{'font-size':config.dataSources.fontSize+'px','color':config.dataSources.titleColor,'text-align':config.dataSources.textAlign,'font-weight':config.dataSources.fontWeight}">
		{{time}}
	</div>
</template>

<script>
/**
 * 实时时间组件
 */
import ComponentView from "@/views/modules/preview/components/common/component-view.js";
import dayjs from "dayjs";
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
export default {
	name: "realTime-view",
	mixins:[ComponentView],
	data() {
		return {
			time:""
		}
	},
	methods: {
		getData(){
			let dataSources=this.config.dataSources;
			let format=dataSources.format || "YYYY-MM-DD";
			let time = dayjs().format(format);
			if(dataSources.showWeek){
				time+=" "+dayjs().format('dddd');
			}
			this.time=time;
		},
	},
	watch: {

	}
}
</script>

<style scoped>
.realTime-view{
	width: 100%;
	padding: 10px;
}
</style>
